//服务层
const {getGoods3,addGoods3,getOne3,updateOne3,deleteOne3,getAllgoods3} = require('../dao/goodsDao');
module.exports.getGoods2 = async page =>{
    return await getGoods3(page);
}
module.exports.getAllgoods2 = async(res,req) =>{
    return await getAllgoods3();
}


module.exports.getOne2 = async (_id) => {
    return await getOne3(_id);
}

module.exports.updateOne2 = async (goods)=>{
    const data = await updateOne3(goods);
    if(data.ok ==1){
        return true;
    }else{
        return false;
    }
    
}
module.exports.deleteOne2 = async (goods)=>{
    const data = await deleteOne3(goods);
    if(data.ok ==1){
        return true;
    }else{
        return false;
    }
    
}

module.exports.addGoods2 = async (goods)=>{
    const data = await addGoods3(goods);
    if (data._id) {
        return true;
    } else {
        return false;
    }
}
